﻿/*****************************************************************//**
 * @file    FITKAcousticsVTKGraphObjectSelectSEANodes.h
 * @brief   Internal graph object for highlighting part of the model or
 *          mesh graph for VTK graph widget.

 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-10-31
 *********************************************************************/

#ifndef __FITKACOUSTICSVTKGRAPHOBJECTSELECTSEANODES_H__
#define __FITKACOUSTICSVTKGRAPHOBJECTSELECTSEANODES_H__

#include "FITKAcousticsVTKGraphObject3D.h"

// Forward declaration
class QVariant;

class vtkDataSet;
class vtkGlyph3D;
class vtkCubeSource;
class vtkStringArray;
class vtkTextProperty;
class vtkUnstructuredGrid;
class vtkPoints;;

class FITKAcousticsVTKGraphActor;
class FITKGraphActor2D;

namespace Core
{
    class FITKAbstractNDataObject;
}

namespace Exchange
{
    /**
     * @brief   Internal graph object for highlighting part of the model or mesh graph.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-10-31
     */
    class FITKAcousticsVTKGraphObjectSelectSEANodes : public FITKAcousticsVTKGraphObject3D
    {
        // Regist
        FITKGraphObjectRegist(FITKAcousticsVTKGraphObjectSelectSEANodes, FITKAcousticsVTKGraphObject3D);
        FITKCLASS(Exchange, FITKAcousticsVTKGraphObjectSelectSEANodes);

    public:
        /**
         * @brief   Constructor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        FITKAcousticsVTKGraphObjectSelectSEANodes();

        /**
         * @brief   Destructor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        ~FITKAcousticsVTKGraphObjectSelectSEANodes();

        /**
         * @brief   Set the data set and the mesh type for visualization.
         * @param   indice: The indice of SEA nodes need to be extracted[quote]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-28
         */
        void setSelectData(QVector<int> & indice);

        /**
         * @brief   Set the glyph size of the SEA node glyph.
         * @param   glyphSize
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        void setGlyphSize(double glyphSize);

        /**
         * @brief   Hide or show the graph object's actor.[override]
         * @param   visibility: The visibility.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        void setVisible(bool visibility) override;

        /**
         * @brief   Enable or disable transparent.[override]
         * @param   isOn: Enable or disable
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        void setTransparent(bool isOn) override;

        /**
        * @brief   Set the color.[override]
        * @param   color: The color
        * @author  ChengHaotian (yeguangbaozi@foxmail.com)
        * @date    2024-10-31
        */
        void setColor(QColor color) override;

        /**
         * @brief   Clear the select data indice.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        void clearData();

    private:
        /**
         * @brief   Initialize the pointers.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        void init();

        /**
         * @brief   Initialize the actor's visualization properties.[override]
         * @param   actor: The actor
         * @param   details: No used
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        void initActorProperties(vtkProp* actor, QVariant details = QVariant()) override;

        /**
         * @brief   Get the SEA node list from the data object.
         * @return  The SEA nodes data
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        Acoustics::FITKAcousticsDiscNodeList* getSEANodesData();

    private:
        /**
         * @brief   The grid data for selected SEA nodes.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-28
         */
        vtkUnstructuredGrid* m_ugrid{ nullptr };

        /**
         * @brief   The points data for selected SEA nodes.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-28
         */
        vtkPoints* m_points{ nullptr };

        /**
         * @brief   The actor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        FITKAcousticsVTKGraphActor* m_fActor{ nullptr };

        /**
         * @brief   The cube glyph for the nodes.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        vtkGlyph3D* m_glyph{ nullptr };

        /**
         * @brief   The cube source for the nodes glyph.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        vtkCubeSource* m_cubeSource{ nullptr };

        /**
         * @brief   The string array stored the text of labels.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-11
         */
        vtkStringArray* m_textArray{ nullptr };

        /**
         * @brief   The actor 2D for label text.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        FITKGraphActor2D* m_fActorText2D{ nullptr };

        /**
         * @brief   The label text property.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        vtkTextProperty* m_textProperty{ nullptr };

        /**
         * @brief   The size of the glyph source.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-31
         */
        double m_glyphSize = 20.;

        /**
         * @brief   The label font size.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        double m_fontSize = 20.;

    };
}   // namespace Exchange

#endif // __FITKACOUSTICSVTKGRAPHOBJECTSELECTSEANODES_H__
